Previous Book Contents Book Index Next

Inside Macintosh: Mac OS 8 Toolbox Reference /
Chapter 1 - Appearance Manager Reference / Appearance Manager Functions
Drawing Appearance-Compliant Menus /


DrawThemeMenuTitle

NEW WITH THE APPEARANCE MANAGER

Draws an Appearance-compliant menu title.

pascal OSStatus DrawThemeMenuTitle (
                     const Rect *inMenuBarRect,
                     const Rect *inTitleRect,
                     ThemeMenuState inState,
                     UInt32 inAttributes,
                     MenuTitleDrawingUPP inTitleProc,
                     UInt32 inTitleData);
inMenuBarRect
On input, a pointer to a rectangle, which should contain the entire menu bar that the title is being drawn into. The menu bar background is drawn in the rectangle passed in the inMenuBarRect parameter. Call GetThemeMenuBarHeight to get the height of the menu bar.
inTitleRect
On input, a pointer to a rectangle, which should contain the entire title. The title background is drawn in the rectangle passed in the inTitleRect parameter. The width of this rectangle is determined by calculating the width of the menu title's content and then calling GetThemeMenuTitleExtra to get the amount of padding between menu titles in the current theme; these two values are added together and added to the left edge of where the title should be drawn. The top and bottom coordinates of this rectangle should be the same as those of the inMenuBarRect parameter.
inState
A value specifying the state (active, selected, or disabled) in which the menu title is to be drawn; see "Appearance-Compliant Menu Draw State Constants".
inAttributes
Reserved. Pass 0.
inTitleProc
On input, a pointer to a menu title drawing function such as MyMenuTitleDrawingProc, defining how to draw the contents of the menu title. The value of the inTitleProc parameter can be a valid universal procedure pointer or nil.
inTitleData
Data to be passed in to the inUserData parameter of MyMenuTitleDrawingProc. This data is usually a pointer to information needed to draw the title's contents, such as a pointer to a string.
function result
A result code; see "Result Codes".
DISCUSSION
The DrawThemeMenuTitle function should be called when you are writing your own custom menu bar definition function and wish to coordinate with the current theme. Your menu title drawing function will be called clipped to the rectangle in which the menu title content is drawn; do not draw outside this region. At the time your menu title drawing function is called, the foreground text color and mode is already set to draw text in the specified state (enabled, selected, or disabled) and correct color for the theme. You do not need to set the color unless you have special drawing needs.

IMPORTANT
You should not depend on the background color for your menu title, so you should not call the EraseRect function from your menu title drawing function.
SPECIAL CONSIDERATIONS
Make sure Appearance Manager 1.0.1 is present before calling the DrawThemeMenuTitle function. See "Appearance Manager Gestalt Selector Constants" for details on how to determine if the Appearance Manager is present and what its version is, if so.


Previous Book Contents Book Index Next

© Apple Computer, Inc.
8 JAN 1998